import * as Phaser from "phaser";

export class Boom extends Phaser.GameObjects.Sprite {
    constructor(scene: Phaser.Scene, x: number, y: number, texture: string, frame: string, scale: number = 1.6) {
        super(scene, x, y, texture, frame);
        scene.time.delayedCall(500, () => {
            this.hide();
        })
        scene.add.existing(this);
        this.setScale(scale)
        this.boom();
    }

    private boom() {
        this.setActive(true);
        this.setVisible(true);
    }

    private hide() {
        this.setActive(false);
        this.setVisible(false);
        this.destroy(true);
    }
}